import React from 'react'
import Reflux from 'reflux'
import Action from '../../../action/action'
import Store from '../../../store/store'
import ReactMixin from 'react-mixin'
import {Link} from 'react-router'


export default class MyAccount extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            userInfo : {},
        }
    }
    componentDidMount(){
        Action.getUserInfo()
    }
    render(){
        let userInfo = this.state.userInfo;
        return(
            <ul className="myAccount">
                <li>
                    <p>头像</p>
                    <div style={{backgroundImage : `url(${userInfo.userImage || ""})`}}></div>
                </li>
                <li>
                    <p>昵称</p>
                    <input value={userInfo.userName} readOnly="readOnly"/>
                </li>
                <li>
                    <p>电话</p>
                    <input value={userInfo.userPhone} readOnly="readOnly"/>
                </li>
                <li>
                    <p>收货地址</p>
                    <Link to="/my/shoppingAddress">
                        <span>管理</span>
                        <i className="iconfont icon-qianjin-copy"></i>
                    </Link>
                </li>
            </ul>
        )
    }
}
ReactMixin.onClass(MyAccount,Reflux.connect(Store));